package com.jieshuibao.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jieshuibao.mapper.TeacherMapper;
import com.jieshuibao.model.db.Teacher;
import com.jieshuibao.model.db.TeacherExample;

@Service
public class TeacherService{
	
	@Resource
	private TeacherMapper teacherMapper;
	
	public void addTeacher(Teacher teacher) {
		teacherMapper.insertSelective(teacher);
	}
	
	public void delTeacherById(String id) {
		teacherMapper.deleteByPrimaryKey(id);
	}
	
	public void updateTeacher(Teacher teacher) {
		teacherMapper.updateByPrimaryKeySelective(teacher);
	}
	
	public void updateTeacherByExample(Teacher teacher,TeacherExample teacherExample){
	    teacherMapper.updateByExampleSelective(teacher,teacherExample);
	}
	
	public Teacher getTeacherById(String id) {
		return teacherMapper.selectByPrimaryKey(id);
	}
	
	public List<Teacher> getPageTeacher(TeacherExample teacherExample) {
		return teacherMapper.selectPage(teacherExample);
	}
	
	public int countTeacher(TeacherExample teacherExample) {
		return teacherMapper.countByExample(teacherExample);
	}
	
	public List<Teacher> selectByExample(TeacherExample example){
	    return teacherMapper.selectByExample(example);
	}
}
